<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HLS Audio Playback</title>
</head>
<body>
    <audio id="audio" controls></audio>
    <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
    <script>
        var audio = document.getElementById('audio');
        var hls = new Hls();

        hls.on(Hls.Events.ERROR, function (event, data) {
    console.log('HLS Error:', data);
});

        if (Hls.isSupported()) {
            // 加载音频流的 URL
            hls.loadSource('https://47.236.245.52:43210/hls/永世狂放~鲜红之花/永世狂放~鲜红之花.m3u8');
            hls.attachMedia(audio);
            hls.on(Hls.Events.MANIFEST_PARSED, function() {
                audio.play();
            });
        } else if (audio.canPlayType('application/vnd.apple.mpegurl')) {
            // 如果浏览器原生支持
            audio.src = 'https://47.236.245.52:43210/hls/永世狂放~鲜红之花/永世狂放~鲜红之花.m3u8';
            audio.addEventListener('loadedmetadata', function() {
                audio.play();
            });
        }
    </script>
</body>
</html>

